/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function pressureLast24Hours() {
        var datatbl = new google.visualization.DataTable();
        //get the data from the file and load it into the google datatable
    $.getJSON('/fetchData.php?data={Fields:Date,Pressure|Sort:Date,Ascending|Interval:1}', function(data) {

             var noElements = data.length;
             datatbl.addColumn('string', 'Date');
             datatbl.addColumn('number', 'Pressure');
             datatbl.addRows(noElements);
        
        //Put the data into the datatable
        $.each(data, function(i, v) {
            // set the values for both the name and the population
            
            datatbl.setValue(i, 0, v.Date.substr(10));
            datatbl.setValue(i, 1, v.Pressure);
        });

        var options = {
          title: 'Todays Pressure'
        };

    //declare the chart (which is a table) and draw it 
    var chart = new google.visualization.LineChart(document.getElementById('graph_pressure_24_hours_div'));
        chart.draw(datatbl, options);
      });
}

